home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 023a / adrsbar.zip / ADRSPRN.PAS < prev    next >
Pascal/Delphi Source File  |  1991-06-28  |  2KB  |  59 lines

  1. (* ADRSPRN was written 6/12/91 by R.B. Shreve, CIS 73757,3523, amateur   *)
  2. (* radio call W8GRG, to work with POSTNT by Dave Barrett to read address *)
  3. (* files in ASCII format and print the postal barcode on the fourth line *)
  4. (* of an address label -- it is released to the public domain under the  *)
  5. (* same terms and conditions as set forth by Dave for POSTNT with which  *)
  6. (* it is combined under the program name ADRSBAR. Address questions or   *)
  7. (* comments to LEARA, PO Box 952, Lee Finance Sta., Shaker Hts., OH 44120*)
  8.  
  9. unit ADRSPRN;
  10.  
  11. interface
  12.  
  13. Uses Printer, Dos, CRT;
  14. var
  15.     FirstName,
  16.     LastName,
  17.     Address,
  18.     City    : String[30];
  19.     State   : String[2];
  20.     Zip     : String[10];
  21. procedure GetAdr(var ff:text);
  22.  
  23. implementation
  24.  
  25. var
  26.     s       : string[30];
  27.     Adrec   : String[100];
  28.     i, n,
  29.     Count   : integer;
  30.  
  31. function GetField(s:string):string;
  32.  
  33. begin
  34.      i:= pos(',',s);            {locates the first comma}
  35.      GetField := copy(s,1,i-1); {copies everything before the comma}
  36.      delete(adrec,1,i)          {deletes the field and comma, so the comma
  37.                                  at the end of the next field is now first}
  38. end;
  39.  
  40. procedure GetAdr(var ff:text);
  41. begin
  42.      FirstName := '';
  43.      LastName := '';
  44.      Address := '';
  45.      City := '';
  46.      State := '';
  47.      Zip := '';
  48.      s:= '';
  49.      i:=0;
  50.      ReadLn(ff, adrec);                  {Get a record}
  51.      FirstName := GetField(adrec);       {Read fields in order}
  52.      LastName := GetField(adrec);
  53.      Address := GetField(adrec);
  54.      City := GetField(adrec);
  55.      State := GetField(adrec);
  56.      Zip := copy(adrec,1,10);        {copy all that remains - there is no
  57.                                         comma after the zipcode}
  58. end;
  59. end.